#! /usr/bin/python
# -*- coding: utf-8 -*-

import conf

def isAdministrator(uid):
    return str(uid) == str(conf.administrator)
def isCreator(uid):
    return str(uid) == str(conf.creator)

def hasEditPaperPermission(xnuid, authorId):
    return str(xnuid) == str(authorId) or isAdministrator(xnuid)

def hasDeletePaperPermission(xnuid, authorId):
    return hasEditPaperPermission(xnuid, authorId)

def hasDeletePaperCommentPermission(xnuid, commenterId, paperAuthorId):
    return str(xnuid) == str(commenterId) or str(xnuid) == str(paperAuthorId) or isAdministrator(xnuid)

#Only creator has permission to reset counters
def hasResetCounterPermission(xnuid):
    return isCreator(xnuid)
